﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AdvanceLib.Core
{
    public class Settings : Singleton<Settings>
    {
        #region Constructors
        public Settings()
        {
            this._entries = new Dictionary<string, object>();
        }
        #endregion

        #region Fields
        private Dictionary<string, object> _entries;
        #endregion

        #region Properties
        public object this[string key]
        {
            get { return this._entries[key]; }
            set
            {
                if (this._entries.ContainsKey(key))
                    this._entries[key] = value;
                else
                    this._entries.Add(key, value);
            }
        }
        #endregion

        #region Methods
        public TObject GetEntryByKey<TObject>(string key)
        {
            if (this._entries.ContainsKey(key))
                return (TObject)this[key];
            else
                return default(TObject);
        }
        #endregion
    }
}
